﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;

namespace OmronFinsUDP
{
    public class Subroutine
    {
        /// <summary>
        /// Ping测试连接
        /// </summary>
        /// <param name="ip">目标ip地址</param>
        /// <param name="timeOut">超时毫秒数</param>
        /// <returns></returns>

        internal static bool PingCheck(string ip, int timeOut)
        {
            Ping ping = new Ping();
            PingReply pr;
            try
            {
                pr = ping.Send(ip, timeOut);
            }
            catch (Exception)
            {
                throw;
            }
            if (pr.Status == IPStatus.Success)
                return true;
            else
                return false;
        }
    }

}
